Introduce ActionRunAttempt to represent each execution of a run#37119
Introduce ActionRunAttempt to represent each execution of a run#37119Zettat123 wants to merge 34 commits intogo-gitea:mainfrom
ActionRunAttempt to represent each execution of a run#37119Conversation
3da69e5 to
7f338dd
Compare
| return err | ||
| } | ||
|
|
||
| run.LatestAttemptID = runAttempt.ID |
There was a problem hiding this comment.
UpdateRunAttempt calls UpdateRun again to sync status/started/stopped. That's three writes to action_run inside one transaction.
There was a problem hiding this comment.
Yes, I’ve noticed that issue as well. In this function, we need to create/update the same ActionRun record three times.
- Create the
ActionRunto getActionRun.ID - Use
ActionRun.IDto create aRunAttemptand writeRunAttempt.IDback toActionRun.LatestAttemptID - After all the jobs are created, update
ActionRun.Status(viaUpdateRunAttempt)
I'm not sure of a better way to handle this yet - any ideas are welcome.
RunAttempt to represent each execution of a runActionRunAttempt to represent each execution of a run
|
|
Two concerns worth addressing: 1. Race condition on concurrent reruns Two simultaneous rerun requests for the same run both read 2.
This comment was written by Claude Opus 4.6. |
|
A few inconsistencies with GitHub's behavior: 1. On GitHub, Example from GitHub (cli/cli run 23574913305):
The 2. Missing GitHub's workflow run response includes 3. Attempt switcher label differs from GitHub On GitHub, the dropdown button shows just This comment was written by Claude Opus 4.6. |
Co-authored-by: silverwind <me@silverwind.io> Signed-off-by: Zettat123 <zettat123@gmail.com>
|
|
Fixed by 7c8e2a8. Please see the latest screenshots in description.
|
Updated |
This PR introduces a new
ActionRunAttemptmodel and makes Actions execution attempt-scoped.Main Changes
ActionRunAttempt. The triggered jobs are then associated with this newActionRunAttemptrecord.ActionRunAttemptrecord for the workflow runActionRunJobrecords for the newActionRunAttemptrerunPlanto manage each rerun and refactored rerun flow into a two-phase plan-based model:buildRerunPlanexecRerunPlanRunAttemptID/actions/runs/{run_id})/actions/runs/{run_id}/attempts/{attempt_num})/repos/{owner}/{repo}/actions/runs/{run}/attempts/{attempt}/repos/{owner}/{repo}/actions/runs/{run}/attempts/{attempt}/jobsCompatibility
LatestAttemptID = 0and legacy jobs useRunAttemptID = 0. Therefore, these fields can be used to identify legacy runs and jobs and provide backward compatibility.RunAttemptID = 0.Improvements
run_attemptsemantics are now aligned with GitHub.TODO
Screenshots
Run with only one attempt:
Rerunning:
Latest attempt:
Previous attempt (rerun is not allowed):
Dropdown for attempt records: